package com.devplatform.pojo.user;

import com.baomidou.mybatisplus.annotation.*;
import com.devplatform.pojo.validateInt.Add;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @TableName user
 */
@TableName(value = "user")
@Data
public class User {
    @TableId(type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    @NotBlank(groups = {Add.class}, message = "昵称不可为空")
    @Size(min = 2, max = 20, message = "昵称长度在2-20之间")
    private String username;

    @NotBlank(groups = {Add.class}, message = "密码不可为空")
    private String password;

    @Email(groups = {Add.class}, message = "邮箱格式错误")
    @NotBlank(groups = {Add.class}, message = "邮箱不可为空")
    private String email;

    private Integer age;

    private Integer gender;

    private String avatar;

    private Integer userStatusId;

    private LocalDateTime createTime;

    //个人简介
    @Size(max = 100, message = "简介不能超过100字")
    private String briefly;

    @TableField("level")
    private Integer level;//等级
    @TableLogic(value = "0", delval = "1")
    private Integer isDelete;//是否被封禁

    private Integer creditScore;//信誉度 默认初始 100

    private Integer role;
}